<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:80:"E:\wamp\www\dataerqi\626\tp5\public/../application/admin\view\article\index.html";i:1499045231;}*/ ?>
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!-- <link rel="Bookmark" href="/favicon.ico" > -->
    <!-- <link rel="Shortcut Icon" href="/favicon.ico" /> -->
    <!--[if lt IE 9]>
    <script type="text/javascript" src="lib/html5shiv.js"></script>
    <script type="text/javascript" src="lib/respond.min.js"></script>
    <![endif]-->
    <!-- Bootstrap core CSS -->
    <link href="/static/zwb/admin/css/bootstrap.min.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="/static/zwb/admin/css/dashboard.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="/static/zwb/admin/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/zwb/admin/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/static/zwb/admin/1.0.8/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/static/zwb/admin/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="/static/zwb/admin/h-ui.admin/css/style.css"/>
    <!--[if IE 6]>
    <script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->

    <title>新闻列表</title>

</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 新闻管理 <span
        class="c-gray en">&gt;</span> 新闻列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px"
                                               href="javascript:location.replace(location.href);" title="刷新"><i
        class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <span class="r">共有数据：<strong><?php echo $art_count; ?></strong> 条</span>
    </div>

    <div class="cl pd-5 bg-1 bk-gray mt-20">
        <h2 class="sub-header glyphicon glyphicon-globe"> 新闻列表</h2>
        <table class="table table-striped table-hover table-bordered" style="text-align: center;">
            <thead class="text-c">
            <tr class="info" style="text-align:center;">
                <th class="col-md-1">新闻ID</th>
                <th class="">新闻标题</th>
                <!--<th class="">新闻封面</th>-->
                <th>上传时间</th>
                <th>热门程度</th>
                <th>状态</th>
                <th>所属用户</th>
                <th>所属频道</th>
                <th class="col-md-2">操作</th>
            </tr>
            </thead>
            <tbody class="text-c">
            <?php if($result): foreach($result as $v): ?>
            <tr style="text-align: center;">
                <td><?php echo $v['aid']; ?></td>
                <td><?php echo $v['aname']; ?></td>
                <td><?php echo date('Y-m-d H:i:m', $v['regtime'] ); ?></td>
                <td><a href="<?php echo url('admin/article/h_status?id='.$v['aid']); ?>"><?php echo !empty($v['hot']) && $v['hot']==1?'<span class="label label-success radius">热门</span>':'<span class="label label-default radius">非热门</span>';; ?></a>
                </td>
                <td><a href="<?php echo url('admin/article/s_status?id='.$v['aid']); ?>"><?php echo !empty($v['dispaly']) && $v['dispaly']==1?'已通过':'未通过';; ?></a>
                </td>
                <td><?php echo $v['tel']; ?></td>
                <td><?php echo $v['cname']; ?></td>
                <td>
                    <!--<button type="button" class="btn btn-primary btn-sm">编辑</button>-->
                    <button data-id="<?php echo $v['aid']; ?>" class="btn btn-default btn-xs show-btn" data-toggle="modal" data-target="#myModal">查看信息</button>
                    <button data-id="<?php echo $v['aid']; ?>" class="btn btn-danger btn-xs del-btn">删除</button>
                </td>
            </tr>
            <?php endforeach; else: ?>
                <tr>
                    <td colspan="8">暂无数据....</td>
                </tr>
            <?php endif; ?>
            </tbody>
        </table>

        <nav aria-label="Page navigation">
            <?php echo $page; ?>
        </nav>

        <!-- Button trigger modal -->
        <!-- <button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
          Launch demo modal
        </button> -->

        <!-- Modal -->
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
            <div class="modal-dialog modal-lg" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>

                    </div>
                    <div style="padding:10px;" id="art_cont">

                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">
                            关闭
                        </button>
                    </div>
                </div>
            </div>
        </div>



        <!-- <span class="glyphicon glyphicon-eject" style="font-size:30px;pxcolor:#f90"></span>  -->
    </div>

</div>
<script src="/static/zwb/admin/js/jquery.min.js"></script>
<!--<script type="text/javascript" src="/static/zwb/admin/h-ui/js/H-ui.min.js"></script>-->
<script src="/static/zwb/admin/js/bootstrap.min.js"></script>
<!--_footer 作为公共模版分离出去-->
<!--<script type="text/javascript" src="/static/zwb/admin/jquery/1.9.1/jquery.min.js"></script>-->
<script type="text/javascript" src="/static/zwb/admin/layer/2.4/layer.js"></script>
<!--<script type="text/javascript" src="/static/zwb/admin/h-ui.admin/js/H-ui.admin.js"></script> &lt;!&ndash;/_footer 作为公共模版分离出去&ndash;&gt;-->

<!--请在下方写此页面业务相关的脚本-->
<!--<script type="text/javascript" src="/static/zwb/admin/My97DatePicker/4.8/WdatePicker.js"></script>-->
<script type="text/javascript" src="/static/zwb/admin/datatables/1.10.0/jquery.dataTables.min.js"></script>
<!--<script type="text/javascript" src="/static/zwb/admin/laypage/1.2/laypage.js"></script>-->

<script type="text/javascript">
    $(function () {
        $('.table-sort').dataTable({
            "aaSorting": [[1, "desc"]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable": false, "aTargets": [0, 8, 9]}// 制定列不参与排序
            ]
        });

    });


    /*用户-编辑*/
    function member_edit(title, url, id, w, h) {
        layer_show(title, url, w, h);
    }

    $(function () {

        // 触发查询单条用户
        $('.show-btn').click(function () {
            var ac_id = $(this).attr('data-id');
            console.log('查看单条数据,UID为:', ac_id);

            showAjax(ac_id); //AJAX查询
        })

        // 执行AJAX 查询单条数据
        function showAjax(id){
            $.ajax({
                type: 'get',
                url: 'read?id='+id,
                dateType: 'json',
                success:function (data){
//                    console.log(data.content);
                    var cont = data.content;
//                    console.log(cont);
                    console.log(data.content);
//                    alert(cont);
                    $('#art_cont').html(cont);
                },
                error: function () {
                    // AJAX执行失败
                    alert('ajax操作失败');
                }
            });
        }

    });



//    删除文章
    $(function () {
        $('.del-btn').click(function () {

            var a_id = $(this).attr('data-id');
            var obj = $(this).parents('tr');
            if (confirm('确认要删除该链接吗')) {
                delAjax(a_id, obj);// 执行删除操作
            }
            function delAjax(id, obj) {
                $.ajax({
                    type: 'GET',
                    url: 'delete?id=' + a_id,
                    dataType: 'json',
                    success: function (data) {
                        obj.remove();
                        layer.msg('删除成功!', {icon: 1, time: 2000});
                    },
                    error: function (XmlHttpRequest, textStatus, errorThrown) {
                        layer.msg('删除失败!', {icon: 5, time: 2000});
                    }
                });
            }

        });
    });

</script>
</body>
</html>
